package amz

import (
	gk "github.com/moovweb/gokogiri"
	html "github.com/moovweb/gokogiri/html"
)

type Asin interface {
	Init(html []byte) (*html.HtmlDocument, error)
	Title() string
	ReviewRating() float64
}

type BaseAsin struct {
	Content []byte
	Doc     *html.HtmlDocument
}

func (c *BaseAsin) Init(html []byte) (doc *html.HtmlDocument, err error) {
	c.Content = html
	doc, err = gk.ParseHtml(c.Content)
	c.Doc = doc
	return
}

type Listing struct {
	Title  string  `json:"title"`
	Rating float64 `json:"rating"`
}
